import Vue from 'vue'
import VueRouter  from 'vue-router'
import Home  from '../views/Home.vue'
import User  from '../views/User.vue'
import Main  from '../views/Main.vue'
import Mall  from '../views/Mall.vue'
import MiyangOne  from '../views/MiyangOne.vue'
import MiyangTwo  from '../views/MiyangTwo.vue'
import Login  from '../views/Login.vue'


Vue.use(VueRouter)
// 1.创建路由组件
//2.将路由与组件进行映射
//3.创建router示例

const routes = [
    //主路由
    {
        path:'/',
        redirect:'/home',//重定向
        component:Main,
        name:'Main',
        children:[
            //字路由
            // {path:'home',name:'home',component:Home},//首页
            // {path:'user',name:'user',component:User},//用户管理
            // {path:'mall',name:'mall',component:Mall},//商品管理
            // {path:'miyang1',name:'miyang1',component:MiyangOne},//米羊1
            // {path:'miyang2',name:'miyang2',component:MiyangTwo},//米羊2
        ]
    },
    {
        path:'/login',
        name:'login',
        component:Login
    }
]

const router = new VueRouter({
    routes
})

export default router



